import com.itheima.config.SpringConfig;
import com.itheima.domain.Trip;
import com.itheima.domain.User;
import com.itheima.service.AccountService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SpringConfig.class)
public class MybatisTest2 {
    @Autowired
    private AccountService accountService;

    @Test
    public void tsetInsertDataToNewTable(){
        List<Trip> list = accountService.QuaryAll();
        for (Trip trip : list) {
            System.out.println("trip = " + trip);
        }
        accountService.insertDataToNewTable(list);
    }

    @Test
    public void testQueryAll(){
        List<User> userList = accountService.newQueryAll();
        for (User user : userList) {
            System.out.println("user = " + user);
        }
    }
}
